//
//  ActivityCell.m
//  XDCommonApp
//
//  Created by XD-XY on 3/10/14.
//  Copyright (c) 2014 XD-XY. All rights reserved.
//

#import "ActivityCell.h"
#import "XDHeader.h"
#import "XDTools.h"

@implementation ActivityCell

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        // Initialization code
        [self makeView];
    }
    return self;
}

-(void)makeView
{
    self.dayLabel = [[UILabel alloc] initWithFrame:CGRectMake(30/2.0f, 40/2.0f-1, 35, 19)];
    _dayLabel.font = [UIFont systemFontOfSize:24.5];
    _dayLabel.backgroundColor = [UIColor clearColor];
    _dayLabel.textColor = [UIColor blackColor];
    _dayLabel.textAlignment = NSTextAlignmentCenter;
    
    self.weekLabel = [[UILabel alloc] initWithFrame:CGRectMake(_dayLabel.frame.origin.x-1, height_y(_dayLabel)+25/2.0f-1, 102/2.0f, 12.5)];
    _weekLabel.font = [UIFont systemFontOfSize:12.5];
    _weekLabel.backgroundColor = [UIColor clearColor];
    _weekLabel.textColor = TEXTBLACKCOLORE4;
    _weekLabel.textAlignment = NSTextAlignmentLeft;

    
    self.titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(width_x(_weekLabel), 43/2.0f, UI_SCREEN_WIDTH-129/2.0f-(width_x(_weekLabel)), 14)];
    _titleLabel.font = [UIFont systemFontOfSize:14];
    _titleLabel.backgroundColor = [UIColor clearColor];
    _titleLabel.textColor = TEXTBLACKCOLORE;
    _titleLabel.textAlignment = NSTextAlignmentLeft;

    
    self.sponsorLabel = [[UILabel alloc] initWithFrame:CGRectMake(_titleLabel.frame.origin.x, height_y(_titleLabel)+16/2.0f, UI_SCREEN_WIDTH-162/2-(width_x(_weekLabel))+10, 12.5)];
    _sponsorLabel.font = [UIFont systemFontOfSize:12];
    _sponsorLabel.backgroundColor = [UIColor clearColor];
    _sponsorLabel.textColor = TEXTBLACKCOLORE5;
    _sponsorLabel.textAlignment = NSTextAlignmentLeft;

    self.plannerLabel = [[UILabel alloc] initWithFrame:CGRectMake(_titleLabel.frame.origin.x, height_y(_sponsorLabel)+10/2.0f, UI_SCREEN_WIDTH-162/2-(width_x(_weekLabel))+10, 12.5)];
    _plannerLabel.font = [UIFont systemFontOfSize:12];
    _plannerLabel.backgroundColor = [UIColor clearColor];
    _plannerLabel.textColor = TEXTBLACKCOLORE5;
    _plannerLabel.textAlignment = NSTextAlignmentLeft;

    self.browseLabel = [[UILabel alloc] initWithFrame:CGRectMake(0,70/2.0f-1, UI_SCREEN_WIDTH-15, 11)];
    _browseLabel.font = [UIFont systemFontOfSize:11.5];
    _browseLabel.backgroundColor = [UIColor clearColor];
    _browseLabel.textColor = TEXTBLACKCOLORE4;
    _browseLabel.textAlignment = NSTextAlignmentRight;
//    _browseLabel.text =@"1142";
    
    CGRect rect = [XDTools xyAutoSizeOfWidget:_browseLabel andSize:CGSizeMake(100, 1000) andtextFont:11.5];
    _browseLabel.frame = CGRectMake(UI_SCREEN_WIDTH-rect.size.width-15, rect.origin.y, rect.size.width, rect.size.height);

    self.rightImageView = [[UIImageView alloc] initWithFrame:CGRectMake(_browseLabel.frame.origin.x-13/2.0f-24/2,74/2.0f, 24/2, 16/2)];
    _rightImageView.image = [UIImage imageNamed:@"hotPoint_attention"];
    
    [self addSubview:_dayLabel];
    [self addSubview:_weekLabel];
    [self addSubview:_titleLabel];
    [self addSubview:_sponsorLabel];
    [self addSubview:_plannerLabel];
    [self addSubview:_rightImageView];
    [self addSubview:_browseLabel];
}


- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
